<template>
  <div class="trainingCertificate">
    <div class="JADP-common-layout-main JADP-flex-main">
      <JADP-table
        v-loading="listLoading"
        :data="list"
        @sort-change="sortChange"
      >
        <el-table-column
          prop="serialnumber"
          label="证书编号"
          align="left"
          width="135"
        />

        <el-table-column prop="certificatename" label="证书名称" align="left">
          <template #default="{ row }">
            <ShowAllText :row="row.certificatename" :num="10" />
          </template>
        </el-table-column>

        <el-table-column
          prop="certificateclassification"
          label="证书分类"
          align="left"
          width="135"
        >
          <template slot-scope="scope">
            {{  scope.row.certificateclassification }}

            <!-- {{ getDict("certificateType", scope.row.certificateclassification) }} -->
          </template>
        </el-table-column>

        <el-table-column
          prop="licensingagency"
          label="证书机构"
          align="left"
          width="135"
        />
        <el-table-column prop="reviewtime" label=" 下次复审时间 " />

        <el-table-column prop="certificatedescription" label="证书描述">
          <template #default="{ row }">
            <ShowAllText :row="row.certificatedescription" :num="10" />
          </template>
        </el-table-column>
      </JADP-table>
      <pagination
        :total="total"
        :page.sync="listQuery.currentPage"
        :limit.sync="listQuery.pageSize"
        @pagination="initData"
      />
    </div>
  </div>
</template>
<script>
import request from "@/utils/request";
export default {
  name: "trainingCertificate",
  inject: ["stuid"],
  data() {
    return {
      list: [],
      listLoading: false,
      total: 0,
      listQuery: {
        currentPage: 1,
        pageSize: 20,
        sort: "desc",
        sidx: ""
      }
    };
  },
  created() {
    this.$nextTick(() => {
      this.initData();
    });
  },
  methods: {
    initData() {
      this.listLoading = true;
      let query_ = {
        ...this.listQuery,
        archivesid: this.stuid.id,
        organizeId:this.$store.getters.organizeId
      };
      request({
        url: `/api/xy_da_certificatemanagement_archives/Xy_da_certificatemanagement_archives`,
        method: "get",
        data: query_
      }).then(res => {
        this.list = res.data.list;
        this.total = res.data.pagination.total;
        this.listLoading = false;
      });
    },
    sortChange({ column, prop, order }) {
      this.listQuery.sort = order == "ascending" ? "asc" : "desc";
      this.listQuery.sidx = !order ? "" : prop;
      this.initData();
    }
  }
};
</script>
<style scoped lang="scss">
.trainingCertificate {
  padding: 10px 20px;
  height: 100%;
  .JADP-common-layout-main {
    height: 100%;
  }
}
</style>
